package com.wkck.controller.frontend;

import com.wkck.VO.CareerDetailsVo;
import com.wkck.VO.PageResult;
import com.wkck.dto.CareerLikeQueryArgumentsDto;
import com.wkck.result.Result;
import com.wkck.service.CareerService;
import com.wkck.utils.CareerInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: CK
 * @Date: 2024/02/27/23:20
 * @Description:
 */
@Api(value = "职位Api", tags = "职位api")
@Slf4j
@RestController
@RequestMapping("/user/career")
public class CareerFrontendController {

    @Autowired
    private CareerService careerService;

    /**
    * @Author: CK
    * @Date: 2024/2/27
    * @Param: [careerLikeQueryArgumentsDto]
    * @Description: 职位列表
    */
    @PostMapping("/list")
    @ApiOperation(value = "岗位列表")
    public Result<PageResult> getCareerList(@RequestBody CareerLikeQueryArgumentsDto careerLikeQueryArgumentsDto) {
        log.info("用户开始模糊查询岗位列表");
        log.info("参数为: {}", careerLikeQueryArgumentsDto);
        return Result.success(careerService.likeQuery(careerLikeQueryArgumentsDto));
    }

    /***
    * @Author: CK
    * @Date: 2024/3/12
    * @Param: [id]
    * @Description: 根据职位id获得信息
    */
    @GetMapping("/get/{id}")
    @ApiOperation(value = "根据职位id获得信息")
    public Result<CareerInfoVo> getFrontendCareerInfoById(@PathVariable("id") Integer id) {
        log.info("根据职位id获得信息 ====> {}", id);
        return Result.success(careerService.getFrontendCareerInfoById(id));
    }

    /***
    * @Author: CK
    * @Date: 2024/3/18
    * @Param: [careerLikeQueryArgumentsDto]
    * @Description: 根据公司名获取公司职位信息
    */
    @PostMapping("/list/name")
    @ApiOperation(value = "根据公司名获取公司职位信息")
    public Result<PageResult> getCareerListByCompanyName(@RequestBody CareerLikeQueryArgumentsDto careerLikeQueryArgumentsDto) {
        log.info("参数为: {}", careerLikeQueryArgumentsDto);
        return Result.success(careerService.likeQueryByName(careerLikeQueryArgumentsDto));
    }
}
